<?php
namespace App;
/**
 * 实例化方法
 */
trait Instance
{
    private static $instance = null;

    public static function instance($newInstance = false)
    {
        if ($newInstance)
            return new static();
        if (null == self::$instance)
            self::$instance = new static();
        return self::$instance;
    }
}